// 玩家数据

let PlayerData = ()=>{
    let that = {};
    // UserID
    that.UserID = undefined;
    // 游戏ID
    that.GameID = undefined;
    // 微信返回的唯一ID
    that.uniqueID = '100001';
    // for(let i=0; i<7; i++){
    //     that.uniqueID += Math.floor(Math.random() * 10);
    // }
    // 名字
    that.nickName = '蜜蜂' + Math.floor(Math.random() * 10);
    // 头像地址
    that.avatarUrl = 'http://p0.so.qhmsg.com/t0133693c3523835cc5.jpg';
    // 分数
    that.houseCardCount = 0;

    // 房间的局数
    that.turnCount = 1;
    // 王炸
    that.kingBombRule = 3;
    // 炸弹
    that.normalBombRule = 2;

    // 微信登录的回调
    that.onWXLoginSuccess = (data)=>{
        that.uniqueID = data.uniqueID;
        that.nickName = data.nickName;
        that.avatarUrl = data.avatarUrl;
    };

    // 登录服务器成功的消息
    that.loginSuccess = (data)=>{
        console.log('loginSuccess = ', JSON.stringify(data));
        that.UserID = data.uid;
        that.GameID = data.uid;
        that.nickName = data.nickName;
        that.avatarUrl = data.avatarUrl;
        that.houseCardCount = data.houseCardCount;
    };

    // 加入房间后服务器返回的游戏规则
    that.joinRoomSuccess = (config, data)=>{
        cc.log(JSON.stringify(config));
        cc.log(' *** *** ' + JSON.stringify(data));
    };

    return that;
};

export default PlayerData;